package org.example.invocationHandler;

import java.lang.reflect.Proxy;

public class Demo {
    public static void main(String[] args) {
        //被代理对象
        People people = new Teacher();

        WorkHandler workHandler = new WorkHandler(people);

        People proxy = (People) Proxy.newProxyInstance(people.getClass().getClassLoader(),
                people.getClass().getInterfaces(), workHandler);
        System.out.println(proxy.work());
    }
}
